<?
include_once "gblinclude.lib";

if ($_GET["flag"] == 0)
	exec("net start PowerBlueExchangeServer", $res);
else
	exec("net stop PowerBlueExchangeServer", $res);

$layoutFactory = new CLayoutFactory();

$header = $layoutFactory->getHeader();
$tail = $layoutFactory->getTail();
$body = createContent();

$js = createJs();

echo $header.$js.$body.$tail;

function createJs()
{
	return '
		<script   language="javascript">   
			window.onbeforeunload = function()
			{
				window.opener.location.reload();
			}
		</script>';
}

function createContent()
{
	global $res;

	
	foreach($res as $line)
	{
		$msg .= $line.'<br />';
	}

	$content .= '<table  border="0" cellspacing="0" cellpadding="0" width="100%">';
			$content .= '<tr height="40">';
				$content .= '<td valign="middle" class="td_content_title"><font color="#000000">&nbsp;Start/Stop File Transfer Server</font>';
				$content .= '</td>';
			$content .= '</tr>';
			$content .= '<tr>';
				$content .= '<td align="center">';
					$content .= ''.$msg;
				$content .= '</td>';
			$content .= '</tr>';
			$content .= '<tr height="35px">';
			$content .= '<td  align="center">&nbsp;';
				$content .= CUIControls::GetNormalButton("btn_cancel", "Close", "button_style", "onclick=\"window.close();\"");
			$content .= '</td>';
					$content .= '</tr>';
		$content .= '</table>';
		

	return $content;
}

?>
